{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=234
  Verdict: Accepted
}
{$APPTYPE CONSOLE}
{$R+,S+,Q+,I+,O-}
uses SysUtils;
var i,r,x,y:longint;
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
readln(x,y);
r:=0;
if (x=y) then else begin
if x<1605 then x:=1604;
if y>=x then begin
  if x mod 10<>5 then begin
    inc(X,abs(x mod 10-5));
    inc(r);
  end;
  if y mod 10<>5 then dec(y,abs(y mod 10-5));
  inc(r,(y-x) div 10);
end;
end;
writeln(r);
end.